package com.anin.demoipastrict;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class RequestLimit {

    /**
     * 对高频ip限制，携带剩余限制时间
     *
     * @param request
     * @return
     */
    @RequestMapping("/error/requestLimit")
    public String requestLimitTime(HttpServletRequest request) {
        Object limitTime = request.getAttribute("remainingTime");
        return "IP已被限制，请稍后在试~"+limitTime;
    }
}
